package com.whw.springboot.walk.controller;


import com.whw.springboot.walk.entity.Message;
import com.whw.springboot.walk.entity.Reback;
import com.whw.springboot.walk.service.RebackService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.List;

@Api(tags = "反馈模块")
@RestController
@RequestMapping("/api/reback")
public class RebackController {

    @Resource
    private RebackService rebackService;

    @ApiOperation(value = "添加")
    @PostMapping(value = "/insert")
    public Message<String> insert(Reback reback){
        return rebackService.insert(reback);
    }

    @ApiOperation(value = "通过主键删除")
    @DeleteMapping(value = "/deleteByPrimaryKey")
    public Message deleteByPrimaryKey(String rebackId){
        return rebackService.deleteByPrimaryKey(rebackId);
    }

    @ApiOperation(value = "通过主键更新")
    @PutMapping(value = "/updateByPrimaryKey")
    public Message updateByPrimaryKey(Reback reback){
        return rebackService.updateByPrimaryKey(reback);
    }

    @ApiOperation(value = "通过主键查询反馈信息")
    @GetMapping(value = "/findByPrimaryKey")
    public Message<Reback> findByPrimaryKey(String rebackId){
        return  rebackService.findByPrimaryKey(rebackId);
    }

    @ApiOperation(value = "查看所有")
    @GetMapping(value = "/findAll")
    public Message<List<Reback>> findAll(){
        return rebackService.findAll();
    }


    @ApiOperation(value = "通过主键查询反馈和反馈信息")
    @GetMapping(value = "/findRebackAndRebackInfo")
    public Message<List<Reback>> findRebackAndRebackInfo(String rebackId){
        return rebackService.findRebackAndRebackInfo(rebackId);
    }
}
